/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package controladores;

import entidades.ConfigFTP;
import entidades.Sesion;
import org.apache.http.Header;
import org.apache.http.message.BasicHeader;
import utiles.json.Parser;

/**
 *
 * @author fcarou
 */
public class ControladorConfigFTP extends BaseControlador
{
    public ControladorConfigFTP ()
    {
        super (Constantes.URL_COMPLETA + Constantes.CONFIG_FTP);
    }
    
    public ConfigFTP getConfigFTP ()
    {
        Sesion sesion = admin.Admin.getInstance().getAdminSesion().getSesion();
        
        if (sesion == null)
            return null;
        
        String res = helper.doGet(Constantes.GET_CONFIG_FTP, new BasicHeader("codigo", sesion.getCodigo()), null);
        
        try
        {
            ConfigFTP config = (ConfigFTP) new Parser().parseObject(res, ConfigFTP.class);
            return config;
        }
        catch (Exception e)
        {
            return null;
        }
    }
}
